﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

using Business;

namespace GestorEventos
{
    public partial class addArtistaEvento : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
               ListaArtista business = new ListaArtista();
               ListaArtista listaArtista = new ListaArtista(business.getListaArtista(1));
               //DropDownListArtistas.Items.Clear();
               //if (!IsPostBack)
               
                   for (int i = 0; i < listaArtista.getListaArtistas().Count; i++)
                   {
                       DropDownListArtistas.Items.Add(listaArtista.getListaArtistas()[i].getNomeArtista());
                   }
               
        }

        public void adicionarArtista(Object o, EventArgs e) {

            
            if (Request.QueryString["eventID"] != null)
            {
                int eventID = Convert.ToInt32(Request.QueryString["eventID"].ToString());

                String nome = DropDownListArtistas.SelectedValue;
               Label1.Text = nome;
               ListaArtista business = new ListaArtista();
               ListaArtista listaArtista = new ListaArtista(business.getListaArtista(1));
               int artistaID = listaArtista.getArtistaIDByNome(nome);

               
               Evento evento = new Evento();

               //bool value = evento.insertArtistEvent(eventID, artistaID, data);
               LabelSeleccionar.Text = evento.insertArtistEvent(eventID, artistaID).ToString();
               Label1.Text = nome;
                /*
                if (value) {
                    ButtonAddArtista.Text = "Cenassona";
                }
                if (!value) {
                    ButtonAddArtista.Text = "FAILZAO";
                }*/
               
            }
            }

                




        }
    }
